package com.cloudpolice.door.feignInterface;

import com.cloudpolice.door.feignInterface.hystric.UploadFileInterFaceHystric;
import lh.model.ResultVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;

/**
 *
 * @author liaoyueli
 * @date 2020-04-15
 */
@Repository
@FeignClient(value = "STATICRESOURCE-MUCON/UploadFileController", fallback = UploadFileInterFaceHystric.class)
public interface UploadFileInterFace {

    /**
     * 获取图片流信息
     *
     * @param id 图片ID
     * @param mobileSign 是否为手机端图片
     * @param isBS 是否为BS，若是，则加头
     * @return
     */
    @PostMapping("/selectFileStreamById")
    String selectFileStreamById(@RequestParam(value = "id") String id
            , @RequestParam(value = "mobileSign", required = false, defaultValue = "false") boolean mobileSign
            , @RequestParam(value = "isBS", required = false, defaultValue = "true") boolean isBS);


    /**
     * 单文件上传
     *
     * @param fileStreamArray byte数组
     * @return
     */
    @PostMapping(value = "/multiPartFileUploadByByteArray")
    ResultVO multiPartFileUploadByByteArray(@RequestBody byte[] fileStreamArray
            , @RequestParam(value = "fileName") String fileName
            , @RequestParam(value = "picRemark", required = false) String picRemark);
}
